# 使用 Python 实现随机生成 200 无重复激活码（或者优惠券），字符串长度大于5以上
import random
num_and_alph = ["1","2","3","4","5","6","7","8","9","0","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
# print(num_and_alph)
# 列表letters装生成的5位字符的券
# 列表 coupons存储生成的所有优惠券
letters = []
coupons = []
for i in range(200):
    for i in range(5):
        letter = random.choice(num_and_alph)
        letters.append(letter)
    coupon=''.join(letters)
    # 判断是不是重复的优惠券
    if coupon in coupons:
        pass
    else:
        letters = []
        coupons.append(coupon)
    print(coupon)
print(coupons)

# 字符串生成逻辑没有问题，但是要求长度大于5。